//
//  def_expression_list.h
//  compilation
//
//  Created by Kevin Le perf on 17/01/12.
//  Copyright (c) 2012 e2co technologie. All rights reserved.
//

#ifndef compilation_def_postfixe_expression_h
#define compilation_def_postfixe_expression_h

/*
 postfix_expression
 : primary_expression {printf("postfix_expression primary_expression\n");}
 | postfix_expression '[' expression ']' {printf("postfix_expression postfix_expression\n");}
 ;
 */
struct def_postfixe_expression{
	void * parent;
	int type;
	struct def_primary_expression * primary_expression;
	struct def_postfixe_expression * postfixe_expression;
	struct def_expression * expression;
};

struct def_postfixe_expression * postfixe_expression_create(void * parent){
	struct def_postfixe_expression * p = malloc(sizeof(*p));
	p->parent = parent;
	p->type = 0;
	return p;
}

void postfix_expression_print(struct def_postfixe_expression * p){
	switch(p->type){
		case 0:
			break;
		case 1:
			primary_expression_print(p->primary_expression);
			break;
		case 2:
			postfix_expression_print(p->postfixe_expression);
			printf("[");
			expression_print(p->expression);
			printf("]");
			break;
	}
}

#endif
